package com.campus.backend.bean.coupon;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 创建优惠券参数
 *
 * @author System
 * @since 2025-01-27
 */
@Data
@ApiModel(description = "创建优惠券参数")
public class CreateCouponBean {

    @ApiModelProperty("优惠券名称")
    @NotBlank(message = "优惠券名称不能为空")
    private String name;

    @ApiModelProperty("类型：1-满减券，2-折扣券")
    @NotNull(message = "优惠券类型不能为空")
    private Integer type;

    @ApiModelProperty("面值/折扣值")
    @NotNull(message = "面值/折扣值不能为空")
    @DecimalMin(value = "0.01", message = "面值/折扣值必须大于0")
    private BigDecimal value;

    @ApiModelProperty("最低消费")
    @NotNull(message = "最低消费不能为空")
    @DecimalMin(value = "0", message = "最低消费不能小于0")
    private BigDecimal minConsume;

    @ApiModelProperty("使用开始时间")
    @NotNull(message = "使用开始时间不能为空")
    private LocalDateTime useStartTime;

    @ApiModelProperty("使用结束时间")
    @NotNull(message = "使用结束时间不能为空")
    private LocalDateTime useEndTime;

    @ApiModelProperty("描述")
    private String description;

    @ApiModelProperty("发行量")
    @NotNull(message = "发行量不能为空")
    @Min(value = 1, message = "发行量不能小于1")
    private Integer total;

    @ApiModelProperty("发放类型：1-自动发放，2-手动领取")
    @NotNull(message = "发放类型不能为空")
    private Integer issueType;

    @ApiModelProperty("发放条件")
    @NotBlank(message = "发放条件不能为空")
    private String issueCondition;

    @ApiModelProperty("领取开始时间")
    @NotNull(message = "领取开始时间不能为空")
    private LocalDateTime receiveStartTime;

    @ApiModelProperty("领取结束时间")
    @NotNull(message = "领取结束时间不能为空")
    private LocalDateTime receiveEndTime;

    @ApiModelProperty("每人限领数量")
    @NotNull(message = "每人限领数量不能为空")
    @Min(value = 1, message = "每人限领数量不能小于1")
    private Integer receiveLimitNum;
}